package com.baidu;

import java.util.Arrays;
import java.util.Scanner;

/**
 * TODO
 *
 * @author lefly
 * @version 1.0
 * @classname StepForword
 * @description
 * @date 2020/11/20 13:33
 */
public class StepForward {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        int res = leastStep(n, str);
        System.out.println(res);

    }

    private static int leastStep(int n, String str) {
        if (n <= 0 || str == null || str.equals("")) {
            return 0;
        }
        char[] data = str.toCharArray();
        int[] dp = new int[n];
        dp[0] = 0;
        for (int i = 1; i < n; i++) {
            int min = Integer.MAX_VALUE;
            for (int j = 0; j < i; j++) {
                if (data[j] == data[i]) {
                    // 字符相等
                    min = Math.min(dp[j], min);
                }
            }
            // 字符+1
            dp[i] = Math.min(min, dp[i - 1]) + 1;
        }
        System.out.println(Arrays.toString(dp));
        return dp[n - 1];
    }

}
